home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 62 / Quick PC 62.iso / I386 / IIS5_01.CAB / IIS_JSBRWHD.ASP1 < prev    next >
Encoding:
Text File  |  1999-06-03  |  5.1 KB  |  284 lines

  1. <%@ LANGUAGE = VBScript %>
  2. <% Option Explicit %>
  3. <!-- #include file="../directives.inc" -->
  4.  
  5. <!--#include file="jsbrowser.str"-->
  6.  
  7. <% 
  8. Const FIXEDDISK = 2
  9. %>
  10.  
  11. <HTML>
  12. <HEAD>
  13.     <TITLE></TITLE>
  14.     
  15.     <SCRIPT LANGUAGE="JavaScript">
  16.     
  17.     var DRIVE= 0;
  18.     var FOLDER = 1;
  19.     var FILE = 2;
  20.     var REDRAW = true;
  21.     
  22.     </SCRIPT>
  23. </HEAD>
  24.  
  25. <BODY BGCOLOR="#CCCCCC" LINK="#000000" VLINK="#000000" ALINK="#000000" TOPMARGIN = 5 LEFTMARGIN = 5 onLoad="loadList();">
  26. <FORM NAME="userform" onSubmit="return false;">
  27.  
  28. <TABLE>
  29. <TR>
  30.     <TD WIDTH = 100%>
  31.         <FONT FACE="Helv" SIZE = 1>
  32.             <%= L_SELDIR_TEXT %>
  33.         </FONT>
  34.     </TD>
  35. </TR>
  36. </TABLE>
  37.  
  38. </FORM>
  39.  
  40. <SCRIPT LANGUAGE="JavaScript">
  41.  
  42.     
  43.     function loadList()
  44.         {
  45.         parent.list.location.href = "JSBrwLs.asp";        
  46.         }
  47.         
  48.     function redrawList()
  49.         {
  50.         parent.list.location.href = "JSBrwLs.asp";        
  51.         }
  52.         
  53.     function expandItem(item,paint)
  54.         {            
  55.             var theList = cachedList;
  56.             var theitem = theList[item];
  57.             theitem.open = true;
  58.             listFunc.selIndex=item;            
  59.             if (!theitem.cached)
  60.             {
  61.                 var thepath = escape(theitem.fspath);
  62.                 thepath = thepath + "&newid=" + theList.length + "&item=" + item;
  63.                 parent.hlist.location.href = "jsbrwset.asp?fspath=" + thepath;
  64.                 theitem.cached = true;                            
  65.             }
  66.             // Changed from if to else if --
  67.             // Let jsbrwset.asp refresh the list.
  68.             else if (paint)
  69.             {
  70.                 listFunc.loadList();
  71.             }                        
  72.         }        
  73.         
  74.     function expandPath(thisPath)
  75.         {
  76.             for (var i=0;i < cachedList.length; i++)
  77.             {
  78.                 if (cachedList[i].fspath == thisPath)
  79.                 {
  80.                     expandItem(i,!REDRAW);
  81.                     return;
  82.                 }
  83.             }
  84.         }
  85.         
  86.         
  87.     function sortOrder(a,b){
  88.  
  89.         x=a.id - b.id
  90.  
  91.         return x
  92.     }
  93.     
  94.     function sortList(){
  95.         cachedList.sort(sortOrder);
  96.     }
  97.             
  98.     function markTerms(){
  99.     
  100.         //marks cached list items as being a terminater (ie, having no siblings)
  101.         //this forces an "end" gif in the tree view...
  102.         
  103.         var i
  104.         var listLength=cachedList.length; 
  105.         for (i=0; i < listLength; i++) {
  106.             cachedList[i].lastChild=isLast(i);
  107.         }
  108.     }
  109.     
  110.     function isLast(item)
  111.     {
  112.         var i;
  113.         last=false;
  114.         var listLength=cachedList.length;         
  115.         if (item+1==listLength)
  116.         {
  117.             last=true;
  118.         }
  119.         else
  120.         {
  121.             if (cachedList[item].parentid==null)
  122.             {
  123.                 last=true;
  124.                 for (i=item+1; i < listLength; i++)
  125.                 {
  126.                     if (cachedList[i].parentid==null)
  127.                     {
  128.                         last=false;
  129.                         break;
  130.                     }
  131.                 }
  132.             }
  133.             else
  134.             {
  135.                 last=true;
  136.                 var y=item+1;
  137.                 while(cachedList[y].parentid >=cachedList[item].parentid)
  138.                 {
  139.                     if(cachedList[y].parentid==cachedList[item].parentid)
  140.                     {
  141.                         if(!cachedList[y].deleted)
  142.                         {
  143.                             last=false;
  144.                             break;
  145.                         }
  146.                     }
  147.     
  148.                     y=y+1;
  149.     
  150.                     if ((y)==listLength)
  151.                     {
  152.                         break;
  153.                     }
  154.                 }
  155.             }
  156.         }
  157.         return last;
  158.     }    
  159.  
  160.     function setPath()
  161.         {        
  162.         if (top.opener.JSBrowser == null)
  163.             {
  164.                 top.close();
  165.             }
  166.             else
  167.             {
  168.                 top.opener.JSBrowser.currentPath = cachedList[listFunc.selIndex].fspath;        
  169.                 top.opener.JSBrowser.BrowserObjSetPath();
  170.                 top.location.href = "JSBrwCl.asp";        
  171.             }
  172.         }                
  173.  
  174.     function listFuncs()
  175.         {
  176.         this.loadList = loadList;
  177.         this.selIndex = 0;
  178.         this.setPath = setPath;
  179.         this.expandItem = expandItem;
  180.         this.expandPath = expandPath;
  181.         }
  182.  
  183.     function listObj(id,fspath,fname,parentid)
  184.         {
  185.             this.id = id;
  186.             
  187.             this.selected = false;
  188.             this.open = false;
  189.             this.cached = false;
  190.                         
  191.             this.fspath = fspath;
  192.             this.fname = fname;
  193.  
  194.             this.lastChild = false;
  195.             if (parentid == null)
  196.             {
  197.                 this.level = 1;
  198.                 this.icon = "fdisk.gif";
  199.                 this.openicon = "fdisk.gif";                    
  200.             }
  201.             else
  202.             {
  203.                 this.level = cachedList[parentid].level+1;            
  204.                 if (parentid == 0)
  205.                 {
  206.                     this.icon = "fdisk.gif";
  207.                     this.openicon = "fdisk.gif";                    
  208.                 }
  209.                 else
  210.                 {
  211.                     this.icon = "cdir.gif";
  212.                     this.openicon = "odir.gif";    
  213.                 }
  214.             }
  215.             this.parentid = parentid;
  216.             this.markTerms = markTerms;
  217.             this.sortList = sortList;
  218.  
  219.         }
  220.     
  221.     cachedList = new Array();    
  222.     listFunc = new listFuncs();
  223.  
  224. <%
  225.  
  226. Dim FileSystem, drives, drive, newid
  227.  
  228. Set FileSystem=CreateObject("Scripting.FileSystemObject")
  229. Set drives = FileSystem.Drives
  230.     %>    
  231. cachedList[0]= new listObj(0,"","<%= L_MYCOMPUTER_TEXT %>",null);
  232. cachedList[0].open = true;
  233. cachedList[0].cached = true;
  234.  
  235. <%
  236. newid = 1
  237. For Each drive in drives        
  238. ' This makes things too slow, but it does only show working drives.
  239. '    if drive.IsReady then
  240.     %>
  241.         cachedList[<%= newid %>]= new listObj(<%= newid %>,"<%= drive.DriveLetter & ":\\" %>","<%= drive.DriveLetter %>",0);
  242.     <%
  243.         newid = newid + 1
  244. '    end if
  245. Next
  246.  
  247. %>    
  248. cachedList[0].markTerms();    
  249.  
  250. var pathCntrl = top.opener.JSBrowser.pathCntrl;
  251. var selpath = "";
  252.  
  253. if (selpath != "")
  254. {
  255.     var lastLength = 0;
  256.     var curLength = 0;
  257.     var x = 0;
  258.     var parsing = true;
  259.     while(parsing)
  260.     {
  261.  
  262.         lastLength = selpath.indexOf("\\",lastLength+1);
  263.  
  264.         if (x > 100)
  265.         {
  266.             parsing = false;;
  267.         }
  268.         x++;
  269.         if (lastLength == -1)
  270.         {
  271.             parsing = false;
  272.         }
  273.         curpath = selpath.substr(0, lastLength+1);
  274.         //alert(curpath);
  275.         expandPath(curpath, !REDRAW);        
  276.     }
  277.     expandPath(selpath, REDRAW);        
  278.  
  279. }
  280. </SCRIPT>
  281.  
  282. </BODY>
  283. </HTML>
  284.